<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>作业样式绑定类</title>
    <script src="../../js/vue3.js"></script>
    <style>
        p{
            font-size: 10rem;
            font-weight: bold;
        }
        .class_1{
            color: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <p v-bind:class="{class_1:checked}">我会变色</p>
        <button v-on:click="btn">彳亍</button>
    </div>
    <script>
        const v_app = Vue.createApp({
            data(){
                return{
                    checked:true
                }
            },
            methods:{
                btn(){
                    if(this.checked){
                        this.checked=false
                    }else{
                        this.checked=true
                    }
                }
            }
        });
        v_app.mount("#app");
    </script>
</body>

</html>